package com.yunke.controller;

import com.yunke.common.result.YunkeResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

/**
 * 云科系统控制器
 * 
 * @author yunke
 * @since 1.0.0
 */
@Tag(name = "系统管理", description = "系统相关接口")
@RestController
@RequestMapping("/api/system")
public class YunkeSystemController {

    /**
     * 系统健康检查
     */
    @Operation(summary = "系统健康检查", description = "检查系统是否正常运行")
    @GetMapping("/health")
    public YunkeResult<Map<String, Object>> health() {
        Map<String, Object> data = new HashMap<>();
        data.put("status", "UP");
        data.put("timestamp", LocalDateTime.now());
        data.put("version", "1.0.0");
        data.put("description", "云科搭子系统运行正常");
        
        return YunkeResult.success("系统运行正常", data);
    }

    /**
     * 获取系统信息
     */
    @Operation(summary = "获取系统信息", description = "获取系统基本信息")
    @GetMapping("/info")
    public YunkeResult<Map<String, Object>> info() {
        Map<String, Object> data = new HashMap<>();
        data.put("name", "云科搭子系统");
        data.put("version", "1.0.0");
        data.put("description", "基于Spring Boot 3.2 + JDK 17开发的搭子组局系统");
        data.put("author", "云科技术团队");
        data.put("contact", "yunke@example.com");
        data.put("startTime", LocalDateTime.now());
        
        return YunkeResult.success("获取系统信息成功", data);
    }

    /**
     * 测试接口
     */
    @Operation(summary = "测试接口", description = "用于测试系统是否正常")
    @GetMapping("/test")
    public YunkeResult<String> test() {
        return YunkeResult.success("测试成功！云科搭子系统已正常启动！");
    }
} 